package cn.stronglink.assetmanage.business.inventory.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

import cn.stronglink.assetmanage.business.check.view.checked.CheckedListFragment;
import cn.stronglink.assetmanage.business.check.view.sync.CheckSyncListFragment;
import cn.stronglink.assetmanage.business.check.view.wait.WaitListFragment;
import cn.stronglink.assetmanage.business.inventory.view.count.InventoryCountFragment;
import cn.stronglink.assetmanage.business.inventory.view.detail.InventoryDetailFragment;
import cn.stronglink.assetmanage.business.inventory.view.sync.InventorySyncFragment;
import cn.stronglink.assetmanage.business.inventory.view.uncount.InventoryUncountFragment;

/**
 * Created by chencongcong on 2018/6/13.
 */

public class InventoryVpAdapter extends FragmentPagerAdapter {
    private String[] pageTitleArr;
    private List<Fragment> fragmentList = new ArrayList<>();

    public InventoryVpAdapter(FragmentManager fm, String[] pageTitleArr) {
        super(fm);
        this.pageTitleArr = pageTitleArr;

        fragmentList.add(0,new InventoryUncountFragment());
        fragmentList.add(1,new InventoryCountFragment());
        fragmentList.add(2,new InventorySyncFragment());
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return pageTitleArr[position];
    }

    @Override
    public Fragment getItem(int position) {
        //创建fragment并返回
        return fragmentList.get(position);
    }

    @Override
    public int getCount() {
        return pageTitleArr == null ? 0 : pageTitleArr.length;
    }


}
